package erp.education.web.action.setup.school;

import org.springframework.beans.factory.annotation.Autowired;

import com.opensymphony.xwork2.ModelDriven;

import erp.education.client.setup.school.CoursesRequest;
import erp.education.server.beans.interfaces.setup.school.CoursesServiceI;
import erp.education.web.common.BaseAction;

public class CoursesAction extends BaseAction implements
		ModelDriven<CoursesRequest> {
	@Autowired
	CoursesRequest coursesRequest;
	@Autowired
	CoursesServiceI coursesService;

	public String coursesLoad() throws Exception {

		this.result = coursesService.coursesLoadService(coursesRequest)
				.getResponseObject();
		getRequest().setAttribute("result", this.result.getResultList());

		return "loadCourses";
	}

	public String saveUpdateCoursesDetails() throws Exception {
		this.result = coursesService.saveUpdateCoursesDetails(coursesRequest)
				.getResponseObject();

		return "loadCourses";
	}

	@Override
	public CoursesRequest getModel() {
		return this.coursesRequest;
	}
}
